class Solution {
public:
    int missingNumber(vector<int>& nums) {
        int n=nums.size();
        int ret=0;
        for(auto e:nums)
        {
            ret^=e;
        }
        for(int i=0;i<=n;i++)
        {
            ret^=i;
        }
        return ret;
    }
};
